import jieba
import jieba.analyse


def is_contains_chinese(strs):
    for _char in strs:
        if '\u4e00' <= _char <= '\u9fa5':
            return True
    return False


word_dict = {}
key_dict = {}
for line in open('C:/Users/yiyehu/Desktop/title.txt', 'r', encoding='UTF-8'):
    item = line.strip('\n\r').split('\t')
    tags = jieba.analyse.extract_tags(item[0])
    for t in tags:
        if t in word_dict:
            word_dict[t] = int(word_dict[t]) + 1
        else:
            word_dict[t] = 1

word_dict = sorted(word_dict.items(), key=lambda x: x[1], reverse=True)
word_dict = [item[0] for item in word_dict if item[1] > 39 and is_contains_chinese(item[0])]

print(word_dict)
